{foreach name="form_data" item="val"}

{if condition="$val.config.is_delete == true || true"}

{if condition="isset($val.config.addShow) && $val.config.addShow"}
{php}continue;{/php}
{/if}
{eq name="val.component" value="input"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input id="c-{$val.id}" class="form-control"{if condition="$val.config.required == true"}data-rule="required"{/if} placeholder="{$val.config.placeholder}" name="row[{$val.id}]"
		type="text" {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]|default=""}"{/if} >
	</div>
</div>
{/eq}

{eq name="val.component" value="input-number"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input id="c-{$val.id}" class="form-control" {if condition="$val.config.required == true"}data-rule="required"{/if}placeholder="{$val.config.placeholder}" name="row[{$val.id}]"
		type="number" {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]|default=""}"{/if}>
	</div>
</div>
{/eq}
{eq name="val.component" value="textarea"}
<div class="col-xs-12 col-sm-10">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<textarea id="c-{$val.id}" class="form-control" {if condition="$val.config.required == true"}data-rule="required"{/if}rows="3" name="row[{$val.id}]"
		placeholder="{$val.config.placeholder}">{$row[$val['id']]|default=""}</textarea>
	</div>
</div>
{/eq}

{eq name="val.component" value="radio"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label >{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<div class="radio">
			{foreach name="val.config.content" item="vo"}
			<label><input name="row[{$val.id}]" type="radio" value="{$vo.value}"
						  {if condition="isset($row[$val['id']])"}
						  {eq name="$row[$val['id']]" value="$vo['value']" }checked{/eq}
				{/if} /> {$vo.value}</label>
			{/foreach}
		</div>

	</div>
</div>
{/eq}

{eq name="val.component" value="checkbox"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label >{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<div class="checkbox">
			{foreach name="val.config.content" item="vo"}

			<label class="checkbox-inline"><input name="row[{$val.id}][]" type="checkbox" {if condition="isset($row[$val['id']])"} {in name="$vo['value']" value="$row[$val['id']]" }checked{/in}{/if}  value="{$vo.value}"/>{$vo.value}</label>

			{/foreach}
		</div>

	</div>
</div>
{/eq}
{eq name="val.component" value="Cascader"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<div class='control-relative'>
			<input id="c-{$val.id}" class="form-control"{if condition="$val.config.required == true"}data-rule="required"{/if} data-toggle="city-picker" name="row[{$val.id}]" type="text"
			value="{$row[$val['id']]|default=""}" />
		</div>
	</div>
</div>
{/eq}

{eq name="val.component" value="select"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<select id="c-{$val.id}"  class="form-control selectpicker" {if condition="isset($val.config.multiple) && $val.config.multiple == true"} name="row[{$val.id}][]" multiple="" {else\} name="row[{$val.id}]" {/if} data-live-search='true'>
			<option value="">请选择</option>
			{foreach name="val.config.content" item="vo" k="key"}
				{if condition="isset($row[$val['id']])"}
					{if condition="$val.data_value neq '' && is_array($val.data_value) && isset($val.data_value[$vo.label])"}

							<option value="{$vo.label}" {eq name="$val.data_value[$vo.label]" value="$vo.label" }selected{/eq}>{$vo.label}</option>

					{else/}
						<option value="{$vo.label}" {eq name="$row[$val['id']]" value="$vo.label" }selected{/eq}>{$vo.label}</option>
					{/if}
				{else/}
				<option value="{$vo.label}" >{$vo.label}</option>
				{/if}
			{/foreach}

		</select>
	</div>
</div>
{/eq}

{eq name="val.component" value="TimePicker"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>

		<input id="c-{$val.id}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss"
			   placeholder="{$val.config.placeholder}"{if condition="$val.config.required == true"}data-rule="required"{/if} name="row[{$val.id}]" value="{$row[$val['id']]|default=""}" type="text">
	</div>
</div>
{/eq}

{eq name="val.component" value="DatePicker"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>

		<input id="c-{$val.id}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" placeholder="{$val.config.placeholder}"
			   name="row[{$val.id}]" type="text" {if condition="$val.config.required == true"}data-rule="required"{/if}
				value="{$row[$val['id']]|default=""}" >
	</div>
</div>
{/eq}
{eq name="val.component" value="Rate"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{$val.config.label}:</label>
		<select id="c-{$val.id}" name="row[{$val.id}]" class="form-control">
			{if condition="isset($row[$val['id']])"}
			<option value="5" {eq name="$row[$val['id']]" value="5" }selected{/eq} >5</option>
			<option value="4" {eq name="$row[$val['id']]" value="4" }selected{/eq} >4</option>
			<option value="3" {eq name="$row[$val['id']]" value="3" }selected{/eq} >3</option>
			<option value="2" {eq name="$row[$val['id']]" value="2" }selected{/eq} >2</option>
			<option value="1" {eq name="$row[$val['id']]" value="1" }selected{/eq} >1</option>
			{else/}
			<option value="5">5</option>
			<option value="4">4</option>
			<option value="3">3</option>
			<option value="2">2</option>
			<option value="1">1</option>
			{/if}
		</select>
	</div>
</div>
{/eq}
{eq name="val.component" value="uploadImage"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<div class="input-group">
			<input id="p-{$val.id}" class="form-control" size="35" name="row[{$val.id}]" type="text"  {if condition="$val.config.required == true"}data-rule="required"{/if} {if condition="isset($row[$val['id'].'_str'])"}value="{:$row[$val['id'].'_str']}"{/if}>
			<div class="input-group-addon no-border no-padding">
						<span><button type="button" class="btn btn-danger faupload"
									  data-resize-quality="0.8"
									  data-resize-width="1024"
									  data-resize-height="768"
									  data-input-id="p-{$val.id}"
									  data-url="qingdongwms/base/upload"
									  data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
									  data-multiple="true" data-preview-id="c-{$val.id}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>

			</div>
			<span class="msg-box n-right"></span>
		</div>
		<ul class="row list-inline faupload-preview" id="c-{$val.id}"></ul>
	</div>
</div>
{/eq}

{eq name="val.component" value="uploadFile"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<div class="input-group">
			<input id="p-{$val.id}" class="form-control" size="35" name="row[{$val.id}]" type="text"  {if condition="$val.config.required == true"}data-rule="required"{/if} {if condition="isset($row[$val['id'].'_str'])"}value="{:$row[$val['id'].'_str']}"{/if}>
			<div class="input-group-addon no-border no-padding">
						<span><button type="button" class="btn btn-danger faupload"
									  data-input-id="p-{$val.id}"
									  data-url="qingdongwms/base/upload"
									  data-multiple="true" data-preview-id="c-{$val.id}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>

			</div>
			<span class="msg-box n-right"></span>
		</div>
	</div>
</div>
{/eq}

<!--金额-->
{eq name="val.component" value="input-money"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input id="c-{$val.id}"  class="form-control"{if condition="$val.config.required == true"}data-rule="required"{/if} placeholder="{$val.config.placeholder}" name="row[{$val.id}]"
		type="number" value="{$row[$val['id']]|default=''}">
	</div>
</div>
{/eq}
<!--	手机号-->
{eq name="val.component" value="input-mobile"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input id="c-{$val.id}" value="{$row[$val['id']]|default=''}" class="form-control"
			   {if condition="$val.config.required == true"}data-rule="required;mobile"{/if}
		placeholder="{$val.config.placeholder}" name="row[{$val.id}]" type="text">
	</div>
</div>
{/eq}
<!--邮箱-->
{eq name="val.component" value="input-email"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input id="c-{$val.id}" value="{$row[$val['id']]|default=''}" class="form-control"
			   {if condition="$val.config.required == true"}data-rule="required;email"{/if}
		placeholder="{$val.config.placeholder}" name="row[{$val.id}]" type="text">
	</div>
</div>
{/eq}
<!--编辑器-->
{eq name="val.component" value="editor"}
<div class="col-xs-12 col-sm-12">
	<div class="form-group col-sm-12">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<textarea id="c-{$val.id}" class="form-control editor"{if condition="$val.config.required == true"}data-rule="required"{/if} rows="5" name="row[{$val.id}]"
		placeholder="{$val.config.placeholder}">{$row[$val['id']]|default=''}</textarea>
	</div>
</div>
{/eq}
<!--开关-->
{eq name="val.component" value="switch"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}
			{$val.config.label}:</label>
		<div class="form-control" style="border: 0">
			<input  id="c-{$val.id}" name="row[{$val.id}]" type="hidden" value="{$row[$val['id']]|default=''}">
			<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$val.id}" data-yes="1" data-no="0" >
				{if condition="isset($row[$val['id']])"}
					{eq name="$row[$val['id']]" value="0"}
					<i class='fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x'></i>
					{else/}
					<i class='fa fa-toggle-on text-success fa-2x'></i>
					{/eq}
				{else/}
				<i class='fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x'></i>
				{/if}
			</a>

		</div>
	</div>
</div>
{/eq}

<!--地理位置-->
{eq name="val.component" value="location"}
<div class="col-xs-12 col-sm-10">
	<div class="form-group col-sm-10">
		<label>地理位置:</label>
		<div class="input-group">
			<input  id="{$val.id}_text"  placeholder="请选择地理地址" value="{$row[$val['id']]|default=''}" class="form-control" disabled type="text"/>
			<div class="input-group-addon no-border no-padding">
							<span><button type="button" data-lng="{$val.id}_lng" data-lat="{$val.id}_lat"
										  data-address="{$val.id}" class="btn btn-primary fachoose-map">
								<i class="fa fa-list"></i> {:__('Choose')}</button></span>
			</div>
		</div>
		<input id="{$val.id}_lng" name="row[{$val.id}_lng]" type="hidden" value="{$row[$val['id'].'_lng']|default=''}"  >
		<input id="{$val.id}_lat" name="row[{$val.id}_lat]" type="hidden" value="{$row[$val['id'].'_lat']|default=''}"  >
		<input id="{$val.id}" name="row[{$val.id}]" type="hidden" value="{$row[$val['id']]|default=''}"  >
	</div>
</div>
{/eq}
<!--地图-->
{eq name="val.component" value="map"}
<div class="col-xs-12 col-sm-10">
	<div class="form-group col-sm-10">
		<label>地理位置:</label>
		<div class="input-group">
			<input  id="{$val.id}_text"  placeholder="请选择地理地址" value="{$row[$val['id']]|default=''}" class="form-control" disabled type="text"/>
			<div class="input-group-addon no-border no-padding">
							<span><button type="button" data-lng="{$val.id}_lng" data-lat="{$val.id}_lat"
										  data-address="{$val.id}" class="btn btn-primary fachoose-map">
								<i class="fa fa-list"></i> {:__('Choose')}</button></span>
			</div>
		</div>
		<input id="{$val.id}_lng" name="row[{$val.id}_lng]" type="hidden" value="{$row[$val['id'].'_lng']|default=''}"  >
		<input id="{$val.id}_lat" name="row[{$val.id}_lat]" type="hidden" value="{$row[$val['id'].'_lat']|default=''}"  >
		<input id="{$val.id}" name="row[{$val.id}]" type="hidden" value="{$row[$val['id']]|default=''}"  >
	</div>
</div>
{/eq}
<!--关联客户-->
{eq name="val.component" value="customer"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label>{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input type="hidden" name="row[{$val.id}]"
			   {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]['id']|default=''}"{/if}
			   {if condition="$val.config.required == true"}data-rule="required"{/if} >
		<div class="form-control">
			<a href="javascript:void(0)" class="r-select-customer" data-name="row[{$val.id}]"
			   data-url="qingdongwms/customer/customer/index?isselect=1" >
				{if condition="isset($row[$val['id']]) && $row[$val['id']]"}
				{$row[$val['id']]['name']|default=''}{else/}【请点击选择】{/if}</a>
		</div>
	</div>
</div>
{/eq}
<!--关联联系人-->
{eq name="val.component" value="contact"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label>{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input type="hidden" name="row[{$val.id}]"
			   {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]['id']|default=''}"{/if}
			   {if condition="$val.config.required == true"}data-rule="required"{/if} >
		<div class="form-control">
			<a href="javascript:void(0)" class="r-select-contacts" data-name="row[{$val.id}]"
			   data-url="qingdongwms/customer/contacts/index?isselect=1" >
				{if condition="isset($row[$val['id']]) && $row[$val['id']]"}
				{$row[$val['id']]['name']|default=''}{else/}【请点击选择】{/if}
			</a>
		</div>
	</div>
</div>
{/eq}
<!--关联合同-->
{eq name="val.component" value="contract"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label>{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input type="hidden" name="row[{$val.id}]"
			   {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]['id']|default=''}"{/if}
			   {if condition="$val.config.required == true"}data-rule="required"{/if} >
		<div class="form-control">
			<a href="javascript:void(0)" class="r-select-contract" data-name="row[{$val.id}]"
			   data-url="qingdongwms/customer/contract/index?isselect=1" >
				{if condition="isset($row[$val['id']]) && $row[$val['id']]"}
				{$row[$val['id']]['name']|default=''}{else/}【请点击选择】{/if}
			</a>
		</div>
	</div>
</div>
{/eq}
<!--关联商机-->
{eq name="val.component" value="business"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label>{if condition="$val.config.required == true"}
			<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input type="hidden" name="row[{$val.id}]"
			   {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]['id']|default=''}"{/if}
			   {if condition="$val.config.required == true"}data-rule="required"{/if} >
		<div class="form-control">
			<a href="javascript:void(0)" class="r-select-business" data-name="row[{$val.id}]"
			   data-url="qingdongwms/customer/business/index?isselect=1" >
				{if condition="isset($row[$val['id']]) && $row[$val['id']]"}
				{$row[$val['id']]['name']|default=''}{else/}【请点击选择】{/if}
			</a>
		</div>
	</div>
</div>
{/eq}
<!--关联员工-->
{eq name="val.component" value="staff"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}
			<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input id="c-{$val.id}" {if condition="$val.config.required == true"}data-rule="required"{/if} class="form-control selectpage"
			   name="row[{$val.id}]" placeholder="请选择员工"
			   data-source="qingdongwms/department/staff/index" type="text"
			   {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]['id']|default=''}"{/if}
			   >
	</div>
</div>
{/eq}
<!--关联部门-->
{eq name="val.component" value="department"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}
			<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<input id="c-{$val.id}" {if condition="$val.config.required == true"}data-rule="required"{/if} class="form-control selectpage"
			   name="row[{$val.id}]" placeholder="请选择部门" data-multiple="true" data-max-select-limit="1"
			   data-source="qingdongwms/department/group/index" type="text"
			   {if condition="isset($row[$val['id']])"}value="{$row[$val['id']]['id']|default=''}"{/if}
		>
	</div>
</div>
{/eq}


{eq name="val.component" value="label"}
<div class="col-xs-12 col-sm-6">
	<div class="form-group col-sm-10">
		<label for="c-{$val.id}">{if condition="$val.config.required == true"}<span style="color:red;">*</span>{/if}{$val.config.label}:</label>
		<select id="c-{$val.id}" name="row[{$val.id}][]" class="form-control selectpicker" multiple="multiple" data-live-search="true">
			{foreach name="val.config.content" item="vo"}
			<option value="{$vo.value}" disabled>{$vo.label}</option>
				{foreach name="vo.children" item="children"}
				<option value="{$children.value}^{$children.color}" {if condition="isset($row[$val['id']])"} {in name="$children['la_va']" value="$row[$val['id']]" }selected="selected"{/in}{/if} style="padding-left: 20px;color: {$children.color}">{$children.label}</option>
				{/foreach}
			{/foreach}
		</select>
	</div>
</div>
{/eq}

{/if}
{/foreach}